tableModel = new DefaultTableModel(null, new String[] {
"Name", "E-mail", "Bank Account" });
- //Maybe there is a better way to avoid interaction.
- //table.setEnabled(false);
table.setModel(tableModel);
JButton btnNewButton = new JButton("Confirm Addition");
try {
acm = (AccountInterface) Naming
- .lookup(___IntNames.AdminManager);
+ .lookup(___IntNames.AccountManager);
} catch (Exception e1) {
System.out.println("Error accessing remote authentication: "
+ e1.toString());
}
- Account accou = accounts.get(table.getSelectedRow());
+
try {
- acm.addAccount(accou);
- am.removeOwnerAdditionRequests(accou);
+ acm.addAccount(table.getSelectedRow());
+ am.removeOwnerAdditionRequests(table.getSelectedRow());
am.saveInstance();
} catch (RemoteException e1) {
- // TODO Auto-generated catch block
e1.printStackTrace();
}
-
- ((DefaultTableModel)table.getModel()).removeRow(accounts.indexOf(accou));
- accounts.remove(accou);
+
+ ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
+
}
}
});
btnDenyAddition.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (table.getRowCount()!=0 && table.getSelectedRow() != -1) {
- Account acc = accounts.get(table.getSelectedRow());
try {
- am.removeOwnerAdditionRequests(acc);
+ am.removeOwnerAdditionRequests(table.getSelectedRow());
am.saveInstance();
} catch (RemoteException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
- ((DefaultTableModel)table.getModel()).removeRow(accounts.indexOf(acc));
- accounts.remove(acc);
+ ((DefaultTableModel)table.getModel()).removeRow(table.getSelectedRow());
}
}
});